/**
 * This class contains unit tests for validating the behavior of Apex classes
 * and triggers.
 *
 * Unit tests are class methods that verify whether a particular piece
 * of code is working properly. Unit test methods take no arguments,
 * commit no data to the database, and are flagged with the testMethod
 * keyword in the method definition.
 *
 * All test methods in an organization are executed whenever Apex code is deployed
 * to a production organization to confirm correctness, ensure code
 * coverage, and prevent regressions. All Apex classes are
 * required to have at least 75% code coverage in order to be deployed
 * to a production organization. In addition, all triggers must have some code coverage.
 * 
 * The @isTest class annotation indicates this class only contains test
 * methods. Classes defined with the @isTest annotation do not count against
 * the organization size limit for all Apex scripts.
 *
 * See the Apex Language Reference for more information about Testing and Code Coverage.
 */
@isTest
private class ctrl_pdfAndProcessSelectionClass_Test {

    static testMethod void myUnitTest() 
    {
    	string result = null;
        PageReference pageRef = null;
        List<SelectOption> resultList = null;
        
        // TO DO: implement unit test
        //Account Object Record...
        Account accountObject = new Account();
        accountObject.Name = 'Test Account';
        //accountObject.LicenseNumber__c = serialObject.id;
        accountObject.License_Application_Step__c = 'Archived';
        accountObject.License_Application_Type__c = 'New License';
        accountObject.Activity__c = 'Trading - One Activity';
        accountObject.License_Issue_Date__c = system.today();
        accountObject.Master_Account_Flag__c = true;
        accountObject.License_Expiry_Date__c = System.Today().addYears(1);
        insert accountObject;
        
        
        //For Location Object Records...
        Location__c locationObject1 = new Location__c();
        locationObject1.Name = 'Test Office';
        locationObject1.Location_Type__c = 'Office';
        locationObject1.Rental_Rate__c = 18000;
        insert locationObject1;
        
        //For Tenancy Object Records...
        RecordType newTenancyRecordType = [select Id,IsActive,SObjectType,DeveloperName from RecordType where DeveloperName = 'New_Tenancy_Contract' AND SObjectType = 'Tenancy_Contract__c'];
        Tenancy_Contract__c tenancyObject = new Tenancy_Contract__c();
        tenancyObject.Location__c = locationObject1.id;
        tenancyObject.RecordTypeId = newTenancyRecordType.id;
        tenancyObject.Tenant__c = accountObject.id;
        tenancyObject.Tenancy_Contract_Start_Date__c = accountObject.License_Issue_Date__c;
        tenancyObject.Tenancy_Contract_Expiry_Date__c = date.TODAY().addyears(1).adddays(-1);
        insert tenancyObject;
        
        //Updating with the current Tenancy Contract Field...
        locationObject1.Current_Tenancy_Contract__c = tenancyObject.Id;
        update locationObject1;
        
        
        //For Setting the Account Extension Object...
        ApexPages.StandardController accountExtendedObject = new ApexPages.StandardController(accountObject);
        ApexPages.CurrentPage().getParameters().put('id',accountObject.id);
        
        //Now Calling the Class for the Salesforce... 
        ctrl_pdfAndProcessSelectionClass accountExtensionClass = new ctrl_pdfAndProcessSelectionClass(accountExtendedObject);
        resultList = accountExtensionClass.getprocessesCheckList();
        resultList = accountExtensionClass.getcommanPdfCheckList();
        resultList = accountExtensionClass.getApplicationRecordTypeOptions();
        resultList = accountExtensionClass.getTenancyContractPdfCheckList();
        pageRef = accountExtensionClass.cancelButton();
        
        //Calling before not selected the any Process Selection ....
        pageRef = accountExtensionClass.displayMessagePanel();
        pageRef = accountExtensionClass.processesProceedButton();
        
        
        //Now Calling for the Application processSelectionString
        accountExtensionClass.processSelectionString = 'Application';
		pageRef = accountExtensionClass.displayMessagePanel();
		pageRef = accountExtensionClass.processesProceedButton();
		
		//Now Calling for the Tracking processSelectionString
		accountExtensionClass.processSelectionString = 'Tracking';
		pageRef = accountExtensionClass.processesProceedButton();
		
		//Now Calling for the Amendment processSelectionString
		accountExtensionClass.processSelectionString = 'Amendment';
		pageRef = accountExtensionClass.processesProceedButton();
		
		//Now Calling for the CancelLicense processSelectionString
		accountExtensionClass.processSelectionString = 'CancelLicense';
		pageRef = accountExtensionClass.processesProceedButton();			
        
        //Now Calling the for the Renew + Change Location 
        accountExtensionClass.processSelectionString = 'RenewalLicenseChangeLocation';
		pageRef = accountExtensionClass.processesProceedButton();
		
		//Now Calling the for the Renew + Change Location 
        accountExtensionClass.processSelectionString = 'RenewalLicenseAddLocation';
		pageRef = accountExtensionClass.processesProceedButton();
		
		
        
        //For PDF Generation...
        accountExtensionClass.commanPDFcheckedList.add('vfp_GenerateLicense');
       	accountExtensionClass.tenancyContractPDFcheckedList.add(tenancyObject.Id);
        pageRef = accountExtensionClass.pdfProceedButton();
        
        
        //For Negative Test Cases...
        accountExtensionClass.accountID = null;
        pageRef = accountExtensionClass.displayMessagePanel();
        pageRef = accountExtensionClass.processesProceedButton();
        accountExtensionClass.commanPDFcheckedList.clear();
        accountExtensionClass.tenancyContractPDFcheckedList.clear();
        pageRef = accountExtensionClass.pdfProceedButton();
        
        //For Negative Values...
        accountObject.Residence_Visa_Quota_Used__c = 23;
        update accountObject;
        
        ApexPages.StandardController accountExtendedObject1 = new ApexPages.StandardController(accountObject);
        ctrl_pdfAndProcessSelectionClass accountExtensionClass1 = new ctrl_pdfAndProcessSelectionClass(accountExtendedObject1);
        
        resultList = accountExtensionClass1.getprocessesCheckList();
        resultList = accountExtensionClass1.getcommanPdfCheckList();
        resultList = accountExtensionClass1.getApplicationRecordTypeOptions();
        resultList = accountExtensionClass1.getTenancyContractPdfCheckList();
        
        accountExtensionClass1.processSelectionString = 'Application';
		pageRef = accountExtensionClass1.displayMessagePanel();
		pageRef = accountExtensionClass1.processesProceedButton();
        
        
        //For Renewal Change Location Negative Test Case....
        //For Location Object Records...
        Location__c locationObject2 = new Location__c();
        locationObject2.Name = 'Test Office 21';
        locationObject2.Location_Type__c = 'Office';
        locationObject2.Rental_Rate__c = 18000;
        insert locationObject2;
        
        //For Tenancy Object Records...
        RecordType renewTenancyRecordType = [select Id,IsActive,SObjectType,DeveloperName from RecordType where DeveloperName = 'Under_Renewal' AND SObjectType = 'Tenancy_Contract__c'];
        Tenancy_Contract__c tenancyObject1 = new Tenancy_Contract__c();
        tenancyObject1.Location__c = locationObject2.id;
        tenancyObject1.RecordTypeId = renewTenancyRecordType.id;
        tenancyObject1.Tenant__c = accountObject.id;
        tenancyObject1.Tenancy_Contract_Start_Date__c = accountObject.License_Issue_Date__c;
        tenancyObject1.Tenancy_Contract_Expiry_Date__c = date.TODAY().addyears(1).adddays(-1);
        insert tenancyObject1;
        
        
        //For Setting the Account Extension Object...
        ApexPages.StandardController accountExtendedObject2 = new ApexPages.StandardController(accountObject);
        ApexPages.CurrentPage().getParameters().put('id',accountObject.id);
        ctrl_pdfAndProcessSelectionClass accountExtensionClass2 = new ctrl_pdfAndProcessSelectionClass(accountExtendedObject2);
        
        //Calling before not selected the any Process Selection ....
        resultList = accountExtensionClass2.getprocessesCheckList();
        resultList = accountExtensionClass2.getcommanPdfCheckList();
        resultList = accountExtensionClass2.getApplicationRecordTypeOptions();
        resultList = accountExtensionClass2.getTenancyContractPdfCheckList();
        accountExtensionClass2.processSelectionString = 'RenewalLicenseChangeLocation';
		
        pageRef = accountExtensionClass2.processesProceedButton();
    }
}